Skip to content

client-presence: Mark disconnected clientId to sessionId mappings #24865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

WillieHabi
Copy link
Contributor

Description

In this change we mark the disconnected clientId to sessionId in the system datastore once they are removed. This information will be useful to newly joined clients, as they can know which connectionIds are not in use anymore.

@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 20:27
@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch labels Jun 17, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a mechanism to mark disconnected client–session mappings in the system datastore so that newly joined clients can see which session IDs are no longer in use.

  • Introduce an optional disconnected flag on ConnectionValueState
  • Fetch and assert the existing session mapping for a client and set its disconnected flag when the client is removed
Comments suppressed due to low confidence (3)

packages/framework/presence/src/systemWorkspace.ts:222

  • [nitpick] The variable name knownSessionID suggests it holds an ID string, yet it’s later treated as an object. Consider renaming it to sessionId and fetching the session state object into a separate variable for clarity.
		const knownSessionID = this.datastore.clientToSessionId[clientConnectionId];

packages/framework/presence/src/systemWorkspace.ts:225

  • It would be good to add a unit test to verify that the disconnected flag is set correctly on the session state when a client is removed, ensuring this new flag behaves as expected.
		knownSessionID.disconnected = true;

packages/framework/presence/src/systemWorkspace.ts:225

  • The value returned by clientToSessionId[clientConnectionId] is likely a primitive session ID (string), so assigning a disconnected property will fail at runtime. You should first retrieve the corresponding ConnectionValueState object from your datastore and then mark its disconnected flag.
		knownSessionID.disconnected = true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant